<!DOCTYPE html>
<html>
	<head>
		<title>当日测算查询</title>
		<meta http-equiv="Pragma" CONTENT="no-cache">
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta name="renderer" content="webkit">
		<%include("/common/include.html"){}%>
	</head>
	<link rel="stylesheet" href="${cxt!}/sb/plugins/ztree/css/zTreeStyle/zTreeStyle.css" type="text/css">
	<script type="text/javascript">
		$(function() {
			var $form_div = $("#queryByCustom div");
			winResize($form_div);
			$(window).resize(function(){//当调整浏览器窗口的大小时，发生 resize 事件
				winResize($form_div);
			});
		})
		
		function btn1(ids){
			loadDialog($('#datagrid'),null, '回访', 'scallVisit/showscallVisit?ids='+ids,'960','552');
		};
		
		function btn2(ids){
			loadDialog($('#datagrid'),null, '查询', 'scallVisit/queryByCallVisit?ids='+ids,'960','552');
		};
		
		function btn4(ids,gkflids){
			if(gkflids=='607f10b77f4d4b908104e990f366a334'){
				$.messager.confirm('提示框','成交顾客不能删除哦！');
			}else{
				$.messager.confirm('提示框', '你确定要删除吗?',function(date){
					if(date){
						btn3(ids);
					}
				})
			}
		}
		
		function btn3(ids){
			var url = "${cxt!}/todaymeasure/updatedataStatus";
			$.post(url, {"ids":ids}, function(result) {
				if(result	){
					$.slideMsg("已删除", parent.$);
					$("#datagrid").datagrid("reload");
				}else{
				 	$.slideMsg("删除失败", parent.$);
				}
			});
		};
		
		$(document).ready(function () {		
			$('#datagrid').datagrid({
				queryParams: {
					'todaydate': $("#todaydate").val()
				},
				singleSelect: true,
				url:'${cxt!}/todaymeasure/todaymeasure',
				fitColumns:true,
				rownumbers: true, //显示序号
				collapsible: true,
				columns:[[
					{field:'name',title:'姓名',width:'6%',align:'center'},
					//{field:'phone',title:'手机',width:'8.5%',align:'center'},
					{field:'gkfl',title:'顾客分类',width:'6%',align:'center'},
					{field:'height',title:'身高(cm)',width:'4%',align:'center'},
					{field:'weight',title:'体重(斤)',width:'4%',align:'center'},
					{field:'standweight',title:'标准体重(斤)',width:'6.5%',align:'center'},
					{field:'delweight',title:'应减体重(斤)',width:'6.5%',align:'center'},
					{field:'targetweight',title:'目标体重(斤)',width:'6%',align:'center'},
// 					{field:'weightday',title:'减重周期(月)',width:'6%',align:'center'},
					{field:'treatment',title:'疗程数(个)',width:'6%',align:'center'},
					{field:'toshopvisitcount',title:'到店回访数(次)',width:'7%',align:'center'},
					{field:'callvisitcount',title:'电话回访数(次)',width:'7%',align:'center'},
					{field:'YNContent',title:'操作',width:'11%',align:'center',
					formatter:function(value,row,index){
						 var  str='<a onclick='+'btn1(\'' + row.ids + '\')'+' class='+'button-edit button-success  l-btn l-btn-small'+'><span class='+'l-btn-left'+'><span  style='+'color:red'+' class='+'l-btn-text'+'>回访</span></span></a>'
						+'<a onclick='+'btn2(\'' + row.ids + '\')'+' class='+'button-edit button-success  l-btn l-btn-small'+'><span class='+'l-btn-left'+'><span  style='+'color:green'+' class='+'l-btn-text'+'>查询</span></span></a>';
						if(row.gkfl!='成交顾客'){
							   str+='<a onclick='+'btn4(\'' + row.ids + '\',\'' + row.gkflids + '\')'+' class='+'button-edit button-success  l-btn l-btn-small'+'><span class='+'l-btn-left'+'><span  style='+'color:blue'+' class='+'l-btn-text'+'>删除</span></span></a>';
						}
						return str
						
					}},
					]]
			});	
		})
	</script>
	<body class="easyui-layout">
		<div>
			<input class="easyui-datebox theme-textbox-radius" id="todaydate" value='${date()}' hidden="hidden" />
			
		</div>
		<div data-options="region:'center'" style="overflow-x:hidden;">
			<table id="datagrid" style="width: 100%; height: 100%;"></table> 
		</div>
	</body>
</html>
